<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>个人查询</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/xadmin.js"></script>
    <script type="text/javascript" src="js/cookie.js"></script>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
</head>
<body>
    <script>
        function status(num){
            if(num === 0){
                return "新建";
            }
            else if(num === 1){
                return "揽收";
            }
            else if(num === 2){
                return "分拣";
            }
            else if(num === 3){
                return "转运";
            }
            else if(num === 4){
                return "派送";
            }
            else if(num === 5){
                return "交付";
            }
        }
        $(function(){
            $("#submit").click(function () {
                var str="http://localhost:8080/es/getPackageListByesId/"+$("#input").val();
                $.ajax({
                    url:str,
                    type:"get",
                    dataType:'JSON',
                    contentType : "application/json; charset=utf-8",
                    success:function(data){
                        if(data.code.code === 0){
                            var packageList=data.packageList;
                            var str2=
                                '<a title="位置信息" href="javascript:;" onclick="x_admin_show( \'详情\',\'express-location.html?Data='+$("#input").val()+'\',900,600)">'+
                                "<i class='layui-icon'>" +
                                "点击查看路线" +
                                "</i> " + "</a> ";
                            var messageData=str2;
                            for(var i = 0;i < packageList.length;i++){
                                messageData += '<ul class="layui-timeline">'+
                                                    '<li class="layui-timeline-item">'+
                                                        '<i class="layui-icon layui-timeline-axis"></i>'+
                                                        '<div class="layui-timeline-content layui-text">'+
                                                            '<h3 class="layui-timeline-title">'+packageList[i].createTime+'</h3>'+
                                                            '<p>'+'快件状态：'+status(packageList[i].status)+'<br>'+
                                                                '从<br>  '+packageList[i].sourceNode+'<br>发往<br>  '+packageList[i].targetNode+
                                                            '</p>'+
                                                         '</div>'+
                                                    '</li>'+
                                                '</ul>'
                            }
                            $("#message").html(messageData);
                        }
                        else{
                            alert(data.code.message);
                        }
                    },
                    error:function(){
                        alert("error");
                    }
                });
            });
        });
    </script>
    <div class="x-nav">
        <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
            <i class="layui-icon" style="line-height:30px;">刷新</i>
        </a>
    </div>
    <div class="x-body">
        <div class="layui-row">
            <form class="layui-form layui-col-md12 x-so" method="#" style="margin-left: 600px">
                <input id="input" class="layui-input" type="text" name="customername" placeholder="请输入快递单号" autocomplete="off" value="">
                <button class="layui-btn" id="submit" type="button"><i class="layui-icon">&#xe615;</i></button>
            </form>
        </div>
    </div>
    <div style="margin-left: 500px" id="message">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 0px;">
            <legend></legend>
        </fieldset>
    </div>
</body>
</html>